<html>
    <head>
        <style>
            body {
                padding: 0;
                margin: 0;
            }

            #parent {
                width: 100px;
                height: 100px;
                background-color: #00cc88;
            }

            #child {
                width: 50px;
                height: 50px;
                background-color: #0077ff;
            }

            #parent.b {
                width: 200px;
                position: absolute;
                top: 100px;
                left: 200px;
                padding: 20px;
                display: flex;
                justify-content: flex-end;
            }

            .b #child {
                width: 100px;
                height: 100px;
            }

            #trigger-overflow {
                width: 1px;
                height: 1px;
                position: absolute;
                top: 2000px;
                left: 2000px;
            }

            [data-layout-correct="false"] {
                background: #dd1144 !important;
                opacity: 0.5;
            }
        </style>
    </head>
    <body>
        <div id="parent"></div>
        <div id="trigger-overflow"></div>

        <script type="module" src="/src/imports/script-assert.js"></script>
        <script type="module" src="/src/imports/projection.js"></script>
        <script type="module" src="/src/imports/script-animate.js"></script>
        <script type="module">
            const { createNode, relativeEase } = window.Animate
            const { matchViewportBox, checkFrame } = window.Assert
            const { frame, recordStats } = window.Projection

            recordStats()

            const parent = document.getElementById("parent")

            const parentProjection = createNode(
                parent,
                undefined,
                {},
                { duration: 0.1 }
            )

            parentProjection.willUpdate()

            parent.classList.add("b")

            parentProjection.root.didUpdate()

            requestAnimationFrame(() => {
                requestAnimationFrame(() => {
                    checkFrame(parent, 1, {
                        totalNodes: 2,
                        resolvedTargetDeltas: 1,
                        recalculatedProjection: 1,
                    })
                })
            })
        </script>
    </body>
</html>
